package com.wuzhazha.javamind.chapter15.test07;

import com.wuzhazha.javamind.chapter15.test04.Generator;

import java.util.Collection;

/**
 * 用于Generator的泛型方法
 */
public class Generators {

    public static <T> Collection<T> fill(Collection<T> collection, Generator<T> gen, int n){
        for(int i = 0 ; i < n; i++){
            collection.add(gen.next());
        }
        return collection;
    }

}
